UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '3Ii3UkiJf1FmDW2jMT7RhBoUIkunR2Hqn6Yv3yaY1GU='
WHERE
key_id = '9612102eb683c77c99225a4645d50d4cd813ce3161bd240cbe37ec92ad16c0ff'
AND (
token = '3Ii3UkiJf1FmDW2jMT7RhBoUIkunR2Hqn6Yv3yaY1GU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)