UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'jAUueNLU0q0gyYkog6IHVTnOgyaRpxodKSNaduMF3hY=' 
WHERE 
  key_id = '9d66a15f17939a75692382084c106d6bf3a292fca62cee70c7f441553cbf8eb4' 
  AND (
    token = 'jAUueNLU0q0gyYkog6IHVTnOgyaRpxodKSNaduMF3hY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026