UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '4OJ8UFrMvST/YbYkqg3+LEOs2aslXFQfB8dAqELQu+M=' 
WHERE 
  key_id = '20c971bf100d593fb6749ae628da31976fadb45b94876df9dd4511b97cc90266' 
  AND (
    token = '4OJ8UFrMvST/YbYkqg3+LEOs2aslXFQfB8dAqELQu+M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040