UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '+3Knc6/6TA0nsFfOptyW6Fg0EnC2BoTu789YMl0RG8M='
WHERE
key_id = 'a59d5ebd5e33ca0424b0767c8c890580c4bf46ad1db6c835d2473b02640a8e33'
AND (
token = '+3Knc6/6TA0nsFfOptyW6Fg0EnC2BoTu789YMl0RG8M='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)