UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'xx5nGKoIXekW3hKCmcbnouss51Bl2XnDhlHPlaeEfCM='
WHERE
key_id = 'a949aac8cb631506fe76ea1f2c36a289547b63bb0914e66f6d0a6b76807a7b11'
AND (
token = 'xx5nGKoIXekW3hKCmcbnouss51Bl2XnDhlHPlaeEfCM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)