UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'AlsTvYY/7VhKJi5OhoceYvul4gCTFUSCS/+f3FvM6hA='
WHERE
key_id = 'e7ac8ea6419d917db46db971ee67cee4c4dc6014546e5216228f6f2661fb1099'
AND (
token = 'AlsTvYY/7VhKJi5OhoceYvul4gCTFUSCS/+f3FvM6hA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)