UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mxBhL5NpVRj8sch+xLIGTJ4U+NtWpupuw8+EmomzK74=' 
WHERE 
  key_id = '375dd9756d799a7a840a1c029991a2212c43562c44254bd32fcfde4823fafb75' 
  AND (
    token = 'mxBhL5NpVRj8sch+xLIGTJ4U+NtWpupuw8+EmomzK74=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032