UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Ce20vCsvhmU26yAXHX3/rzrDE2Cl6OXEmFie3jwTTx4='
WHERE
key_id = '34391d4e4fead6a857c7149cebcc648398a0e6b8417eaf55ebda18e973334f14'
AND (
token = 'Ce20vCsvhmU26yAXHX3/rzrDE2Cl6OXEmFie3jwTTx4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)