UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KDU7woIaDltvI6WAS+74VxQVaw4kKJr0J2TFPtlaFSQ='
WHERE
key_id = '6bbac215efa5b1fcee2c84d786ce0e36cfddd9c25659e976c99539a6bde90778'
AND (
token = 'KDU7woIaDltvI6WAS+74VxQVaw4kKJr0J2TFPtlaFSQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)