UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Arm3hn+02mQoSOX2odjyWQXHEpfT9MSaXmp1uSsAgX4=' 
WHERE 
  key_id = '4cd3b4b24a486226e5b2e3f0c2e09bc03baa8041f0b40ab26a10852f87e36ea6' 
  AND (
    token = 'Arm3hn+02mQoSOX2odjyWQXHEpfT9MSaXmp1uSsAgX4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021