UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'UR05n92ZHOCi2RI+8B1NbD1k6udkfVz73ps+0gtuolM='
WHERE
key_id = '58b5ca602bf910333521ad8e3072c5abc89d105144f05e547b31bf120a551cc6'
AND (
token = 'UR05n92ZHOCi2RI+8B1NbD1k6udkfVz73ps+0gtuolM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)