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