UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'NRETZyvwr3/CB7cZCyQJIbdEE9IS7EXfwRfdTaVYcuI='
WHERE
key_id = 'a332f4d2034cb3593c753ef9e79e70e3781b176fab384356e8bf2dfd58ce19a2'
AND (
token = 'NRETZyvwr3/CB7cZCyQJIbdEE9IS7EXfwRfdTaVYcuI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)