UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'xgAmscwSHefSy5JGL5LoUB8Bj0hRMeb489NoMYEEIeA='
WHERE
key_id = '3b198d52cf09d6a9be806e9cafe245b147769e55659867e03127c3fb71d81f03'
AND (
token = 'xgAmscwSHefSy5JGL5LoUB8Bj0hRMeb489NoMYEEIeA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)