UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'LW1CX78/NTo/3G/paBl3ozjjyDJ7PYVdhrL9YFfujLE='
WHERE
key_id = '5ff45364f645928f56ea144ef1e973b11a4f52777a54db57da69ebcebf0a41e7'
AND (
token = 'LW1CX78/NTo/3G/paBl3ozjjyDJ7PYVdhrL9YFfujLE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)