UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JEHFU4xSH4q2OT1PVTXo5yEbx/m2rOvJCVCbb1ogFFE=' 
WHERE 
  key_id = 'e18ad28890a0fd747cb0ed8d29b4e72d485584cf8c22ac50789e599e4193095f' 
  AND (
    token = 'JEHFU4xSH4q2OT1PVTXo5yEbx/m2rOvJCVCbb1ogFFE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026