UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'x5VRc7vSGAW7E2FoAgfRspHuqwX2QTxCEY2u8psJnkE='
WHERE
key_id = '50082925a1418a203fb7b9f3505cd7df090234d673cebf9bc1ccdb276a9a7831'
AND (
token = 'x5VRc7vSGAW7E2FoAgfRspHuqwX2QTxCEY2u8psJnkE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)