UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7EAflcwKldqXccPS144hxIb0gP5qNx98hlZiHmdIs+0=' 
WHERE 
  key_id = 'c6a8785c11230dbac00449ab85259ad03568d22559621ea5c56a64c21884d27b' 
  AND (
    token = '7EAflcwKldqXccPS144hxIb0gP5qNx98hlZiHmdIs+0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022