UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'tVAq2RVmp8xeFBICU1rvsdj+TlfZ3to/hTcslKOmz+M='
WHERE
key_id = 'd640ece0a730674859b7c7be1a9be55911179921bbfef1f6e2bcdef07aef5c8d'
AND (
token = 'tVAq2RVmp8xeFBICU1rvsdj+TlfZ3to/hTcslKOmz+M='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)