UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Ou/CU4Pm/eep6JM+zN7QXTkJDux1pD+GQtOk1bUYWh8=' 
WHERE 
  key_id = 'b31ae137fce91108697d92f96c9f3d13dd9598453b88a4300880264168977786' 
  AND (
    token = 'Ou/CU4Pm/eep6JM+zN7QXTkJDux1pD+GQtOk1bUYWh8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037