UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'PUZnLtjp2Jtq6UOrILklluqnxPVaaHI1GaDps+ircgg='
WHERE
key_id = '8de6b9a97490924d4a8e8c5391a8ec13c409dc1acde52c78db0eb0bad2210f4b'
AND (
token = 'PUZnLtjp2Jtq6UOrILklluqnxPVaaHI1GaDps+ircgg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)