UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'irP6wEAL6qU0/TITGMJ8Ke3NdCH1PFRqK057h30EFAU='
WHERE
key_id = '4b87becbd8d1f31ab91fb16ad2835547c9f016b16d050fce48b2139e755ccd07'
AND (
token = 'irP6wEAL6qU0/TITGMJ8Ke3NdCH1PFRqK057h30EFAU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)