UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'csy5bWZTiGOl5rXUhkA/kBqEexPPT+CzZK4vwVZKrSU=' 
WHERE 
  key_id = 'd4d8c86d32d84727e0a4059e31d93f9f017619bb243b4f2615eb22060c0266bb' 
  AND (
    token = 'csy5bWZTiGOl5rXUhkA/kBqEexPPT+CzZK4vwVZKrSU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041