UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'E590T/C2kh+5vsbmM/svbaMev1dskyRVycdgQRCvWmw=' 
WHERE 
  key_id = '56efaa114c872f85b2e3677471d9a2873a6c6ef6844577b5358dd22db5823ba6' 
  AND (
    token = 'E590T/C2kh+5vsbmM/svbaMev1dskyRVycdgQRCvWmw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030