UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'N23k4p6+QY1XDbNcLLABs5jaPcZENieTOdfd28xLyl0='
WHERE
key_id = '9fcc4e47181cbc36df2f6831738e4f1283839fa8f6f9cc14fb6012ab8f7f6677'
AND (
token = 'N23k4p6+QY1XDbNcLLABs5jaPcZENieTOdfd28xLyl0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)