UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '/Ov0+xdnC3SgY+Cuv/epcbDwCYAfwqpbn2WZ7Fii9bE='
WHERE
key_id = 'c5c99a6466c092a7c135a87ba7a3e150f545e2f50020a2966b43fb84dbc2277e'
AND (
token = '/Ov0+xdnC3SgY+Cuv/epcbDwCYAfwqpbn2WZ7Fii9bE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)