UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5YIevrZV1qNTqJeIygWA9TiB6mwYj7DgfXq2cpaS4ko=' 
WHERE 
  key_id = '3db1678fc39a12022c75212f2145b8ccdc195223f51ced36d8bd71a924892beb' 
  AND (
    token = '5YIevrZV1qNTqJeIygWA9TiB6mwYj7DgfXq2cpaS4ko=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00086