UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Lxp2GtfrRaAFx7+iLHkqzcuPPllRZ79EdN5UrnCEe5w=' 
WHERE 
  key_id = 'ceb80cb1d8b85c51ef5c67bba3150f5d43d54f787927a60365660b34c8b88808' 
  AND (
    token = 'Lxp2GtfrRaAFx7+iLHkqzcuPPllRZ79EdN5UrnCEe5w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030