UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Zg09TyfIH7pT1E4LvLy3Lkty7RozmwAjDmM0vB9p9ow='
WHERE
key_id = '5f24cbecf9030f91ed88db6c26b17c2d4f88a8e4ddcd73a75a9683ebc7df78b6'
AND (
token = 'Zg09TyfIH7pT1E4LvLy3Lkty7RozmwAjDmM0vB9p9ow='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)