UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '9mR92h4NnvriJOmX7peVUks+UPbIplxG7vCIZ1cSxng='
WHERE
key_id = '990992c6f545d9d08233b6e69df5de5f39a14355a25628b4e031ef70baaebe9b'
AND (
token = '9mR92h4NnvriJOmX7peVUks+UPbIplxG7vCIZ1cSxng='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)