UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qNYDrMLGdG0th8jqmnu+6ghOp1yWPK421AKnkghX3P0='
WHERE
key_id = 'd1ea97e3a53ce011c3c604d132b73f77a2c7df3d02b918eb4aa4e6ec1e74cae4'
AND (
token = 'qNYDrMLGdG0th8jqmnu+6ghOp1yWPK421AKnkghX3P0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)