UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KrdRkBtK+WFS3fTEFrrfVmiD27aaWa1k0AkkylWdNk8='
WHERE
key_id = '59afc617c3415a6ae2f1613a015f883e567ec1c71926e0508238dc75722aaca4'
AND (
token = 'KrdRkBtK+WFS3fTEFrrfVmiD27aaWa1k0AkkylWdNk8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)