UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pjZCwO/5GU7Tb4OrgwZiD2WV3L+p+8E6lm3SYkvAUdo=' 
WHERE 
  key_id = 'f783b4de12e2756f744c84746c6bb6628e5a95b4562d03fad504d3c35f53735b' 
  AND (
    token = 'pjZCwO/5GU7Tb4OrgwZiD2WV3L+p+8E6lm3SYkvAUdo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024