UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'xn9Jwo7Ypvsm5J2VkhfrWkig4Yx6hy9lUFze5TX0T14='
WHERE
key_id = '5f15f538d1494003810fdac3d0c703df82a0e8270b3ec5d99cd403b0e4c58799'
AND (
token = 'xn9Jwo7Ypvsm5J2VkhfrWkig4Yx6hy9lUFze5TX0T14='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)