UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7CVp9JFw9C5rK3PtQxZIknUm3xaPOjsIDyDYxixyjiI=' 
WHERE 
  key_id = '5df67efdd4b652c65f8b9777d91805e51e297023531e875f6d2697a8c3a31754' 
  AND (
    token = '7CVp9JFw9C5rK3PtQxZIknUm3xaPOjsIDyDYxixyjiI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038