UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pnla+NGEyT2AOP17tjtx2a/pvqNgiScU3t8Zur58Sv4=' 
WHERE 
  key_id = '17bd0d348844abd1adc245e82dc2dab30ec94d81f1ed5134670b4468e47031b5' 
  AND (
    token = 'pnla+NGEyT2AOP17tjtx2a/pvqNgiScU3t8Zur58Sv4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032