UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'awmoUCKcyQvVr0c41im32XQfAmCFJMbTqUVLjlF8Sys=' 
WHERE 
  key_id = 'df9031991477bd55c29d9989542e2c0f8d3fa25a2c3fc2ee5c6e1509a67cc5c8' 
  AND (
    token = 'awmoUCKcyQvVr0c41im32XQfAmCFJMbTqUVLjlF8Sys=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025