UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NDWNCKUwVTCm8nT+scnrR2vILS/Tpcyf/kYNbdrOo7Q=' 
WHERE 
  key_id = 'f1367f26f922d03d9cfd3887777caa6c20fcf1153d2101372c0a6cfbf55dfde8' 
  AND (
    token = 'NDWNCKUwVTCm8nT+scnrR2vILS/Tpcyf/kYNbdrOo7Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00053