UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'jPa41tc4umM+F+mWKC1wESuak/mMBnWAQq6TSL0T9YY='
WHERE
key_id = '391a54c512ea4bf0da1ecd9e73c722a59b986c29d020a470aefc64f6c340f43a'
AND (
token = 'jPa41tc4umM+F+mWKC1wESuak/mMBnWAQq6TSL0T9YY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)