UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0EI3V+842p+5HXsM5rjthmL0BAXdF6VJymuxFEkAmC0=' 
WHERE 
  key_id = '2a8e9b678bc5aa7b9db616da7c03f7bdf3c2e921c54a9ed572230e91769d3800' 
  AND (
    token = '0EI3V+842p+5HXsM5rjthmL0BAXdF6VJymuxFEkAmC0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036