UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wO/niW7N1P2NulVU0Mwogkls03xMpBopUMhR15JkUsI=' 
WHERE 
  key_id = 'd15aae3d7d82c4d3ebdb55629ee81447c5bf25b220f1d08e9dfdad4230781f5e' 
  AND (
    token = 'wO/niW7N1P2NulVU0Mwogkls03xMpBopUMhR15JkUsI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028