UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '+haKWoQqvjLYVIlsKMC5qv+1A7i9QfcFd9Q7Jy5wdY0='
WHERE
key_id = '01b478b4ea5c9939d4a87c8f4a49257cf16f52ef537355a6bc7a984fe29967d4'
AND (
token = '+haKWoQqvjLYVIlsKMC5qv+1A7i9QfcFd9Q7Jy5wdY0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)