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