UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'PivXiJB3oPpB5HzaCiSpuGa+FaW04g8rGCI1JAjIstg='
WHERE
key_id = 'fc9d1c2889cfe8070bbafacc6e93c9230873a3957c4b9565a305f896f3991790'
AND (
token = 'PivXiJB3oPpB5HzaCiSpuGa+FaW04g8rGCI1JAjIstg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)