UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'jEhdqe40MNU77/9VYyakj36LfbNfPntn7aP38vRichI='
WHERE
key_id = 'f9d953cd7cb6dd1547f16bf6e2158f1eb5164642e2823c45eb07c6971888eb3e'
AND (
token = 'jEhdqe40MNU77/9VYyakj36LfbNfPntn7aP38vRichI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)