UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yGIoUs9Y/myACJIKsyHNKgOYt2/z5/TYmlpEptuHmAo=' 
WHERE 
  key_id = '248261ad60480ae3364209103f70eabbf17af66b4e44d49a24ff066dc1974d96' 
  AND (
    token = 'yGIoUs9Y/myACJIKsyHNKgOYt2/z5/TYmlpEptuHmAo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036