UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'QaZIUPtUMznybcOycAOxu1Gwa4A5yINXaX0XPdhTClo='
WHERE
key_id = '16fd7a1b27ec5e5e0d375a527ec25d1201231fee3fdda160bc78c6be13d827a6'
AND (
token = 'QaZIUPtUMznybcOycAOxu1Gwa4A5yINXaX0XPdhTClo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)