UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'trBEecZoOVo+ckEmfkDxo9vChZKsE/FPv/T/I8Ykci4='
WHERE
key_id = '0388557ac0c8a5404c4246b833ceb62d7fe0568ef272f2f74a810c43d5745ba2'
AND (
token = 'trBEecZoOVo+ckEmfkDxo9vChZKsE/FPv/T/I8Ykci4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)