UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'c/x6Foun3lMjCsfxxwgi/APz9unUcpbPNtZRSzmcIsc=' 
WHERE 
  key_id = 'abe0ded3723667ba52e9745926dca386193fedc51d83962f93d1cc99616909f4' 
  AND (
    token = 'c/x6Foun3lMjCsfxxwgi/APz9unUcpbPNtZRSzmcIsc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036