UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '4+RED2Wu8OpMS7JO+GcCcMA5QqPHCL8n5Ph74Vj1vCE=' 
WHERE 
  key_id = '2743d7e88d479151508b208514e9ab4b4b93ddcefc1ee7db1a3afd388db8b72e' 
  AND (
    token = '4+RED2Wu8OpMS7JO+GcCcMA5QqPHCL8n5Ph74Vj1vCE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00060