UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '9dYzPlYTjnbkQ9IHdIqGI+3aSmW2pLdcldfbtjHt1n0='
WHERE
key_id = 'f02ee7992be01c0930bbc50f392b87f46c373ee9ef4a02064e3ab149846671cd'
AND (
token = '9dYzPlYTjnbkQ9IHdIqGI+3aSmW2pLdcldfbtjHt1n0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)