UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KVS3XPfY86vt6+bka8O6A4SU3Dkl+e2JgfuarMXmED0=' 
WHERE 
  key_id = 'd9890d1a156d680e8f251a98a6064aed624dbef7d4bc29a476cc436ba8f96555' 
  AND (
    token = 'KVS3XPfY86vt6+bka8O6A4SU3Dkl+e2JgfuarMXmED0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036