UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tUQMq5IlqGc7j+hZe0GuGGhlj0+Bl5AIvZIkPNcA9F4=' 
WHERE 
  key_id = '6595423396ccbe3e4f21cf65783ad05cc4e44e6eaebecc8c423e3bdd3815aea8' 
  AND (
    token = 'tUQMq5IlqGc7j+hZe0GuGGhlj0+Bl5AIvZIkPNcA9F4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030