UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BeIdsYOrvLGQ2ineukImX95HahZe3Lu2OTuaMt4BQjs='
WHERE
key_id = '97c66ed8608321659f0dce4776e226802f40f2260de5a6243f32996a87d59a1c'
AND (
token = 'BeIdsYOrvLGQ2ineukImX95HahZe3Lu2OTuaMt4BQjs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)