UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7LkkuuTaVajfSHenrSzB4xT/SV2opSuhnzYB+PBKgHk=' 
WHERE 
  key_id = '52f0d728bf36c9e168946690e593d7e7f2488280524029ca8215500a6e94bb15' 
  AND (
    token = '7LkkuuTaVajfSHenrSzB4xT/SV2opSuhnzYB+PBKgHk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029