UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'QEC6jz7UOVwg2mTigu2vaUKU0d9GWkShDFNjwVkiIa4='
WHERE
key_id = '349ff643cd8a82810dc142859faaec154822a29af6e8431ee5deee272ea1f62f'
AND (
token = 'QEC6jz7UOVwg2mTigu2vaUKU0d9GWkShDFNjwVkiIa4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)