UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ei32mPVcU+/VE5wbN8Xmj7GikocGWCdySFRRIp2dMc8='
WHERE
key_id = 'e19bc2dfc22dbeb1849b5493974e72439234374e7c4ae96c02186182c0bee925'
AND (
token = 'ei32mPVcU+/VE5wbN8Xmj7GikocGWCdySFRRIp2dMc8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)