UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'X7BcU3BcitIUrpmq+KywM1W6Xf4Rm6N4KHDz7KhQHU0='
WHERE
key_id = '000fb60b6b9bef5ae95d6f5dbe169c9804b93704109ec5dea37dfbf87f789ce4'
AND (
token = 'X7BcU3BcitIUrpmq+KywM1W6Xf4Rm6N4KHDz7KhQHU0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)