UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'lA5RqivYXrDIzPpneXdnpI1pX//v8kQrjnzmP2oBcm8='
WHERE
key_id = 'c623d8562e39e8df334853a99cf5121f84acf29a804fc18fe7323479c7311226'
AND (
token = 'lA5RqivYXrDIzPpneXdnpI1pX//v8kQrjnzmP2oBcm8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)